Conditions | 2 |
Total Lines | 13 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { Inject } from '@nestjs/common'; |
||
16 | |||
17 | public async execute(command: CreateShippingCostCommand): Promise<string> { |
||
18 | const { weight, price } = command; |
||
19 | |||
20 | if (true === (await this.isShippingCostAlreadyExist.isSatisfiedBy(weight))) { |
||
21 | throw new ShippingCostAlreadyExistException(); |
||
22 | } |
||
23 | |||
24 | const shippingCost = await this.shippingcostRepository.save( |
||
25 | new ShippingCost(weight, Math.round(price * 100)) |
||
26 | ); |
||
27 | |||
28 | return shippingCost.getId(); |
||
29 | } |
||
31 |